import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */

//class Person{
//    private String name;
//    private  int age;
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public int getAge() {
//        return age;
//    }
//
//    public void setAge(int age) {
//        this.age = age;
//    }
//
//    public void show(){
//        System.out.println("我叫" + name+ ",今年" + age +"岁");
//
//    }
//}
//
//public class TestDemo {
//    public static void main(String[] args) {
//        Person person = new Person();
//        person.setName("曹操");
//        String name = person.getName();
//        System.out.println(name);
//        person.show();
//    }
//}

//class People{
//    private String name;
//    private  int age;
//    private String sex;
//
//    //默认构造函数
////    public People(){
////        this("lisi",20,"女");
////    }
////
////    //带3个参数的构造函数
////    public People(String name ,int age ,String sex){
////        this.name = name;
////        this.age = age;
////        this.sex = sex;
////    }
//
//    public void show(){
//        System.out.println("name:" + name +"age:" + age +"sex:" + sex);
//    }
//}
//
//public class TestDemo{
//    public static void main(String[] args) {
//        People p1 = new People();
//        System.out.println(p1);
////        p1.show();
////        People p2 = new People("zhangfei",80,"男");
////        p2.show();
//    }
//}

//class Person{
//    private String name;
//    private int age;
//    private String sex;
//    private static int count = 0;
//
//    public Person(){
//        System.out.println("I am Person init()");
//    }
//
//    {
//        this.name = "zhangsan";
//        this.age = 12;
//        this.sex = "man";
//        System.out.println("I am instance init()");
//    }
//
//    static {
//        count = 10;//只能访问静态数据成员
//        System.out.println("I am static init()");
//    }
//
//    public void show(){
//        System.out.println("name:" + name +"age:" + age+ "sex:"+ sex);
//    }
//
//}
//
//public class TestDemo {
//    public static void main(String[] args) {
//        Person p1 = new Person();
//        Person p2 = new Person();
//    }
//}

class Person{
    private String name;
    private int age;

    public Person(String name,int age){
        this.age = age;
        this.name = name;
    }

    public void show(){
        System.out.println("name:"+name+"age"+age);
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

public class TestDemo {
    public static void main(String[] args) {
//        Person person = new Person("caocao",18);
//        person.show();
//        System.out.println(person);
        new Person("caocao",18).show();
    }
}
